$o-default-report-font: 'Lato' !default;
$o-default-report-primary-color: rgb(0, 0, 0) !default;
$o-default-report-secondary-color: rgb(0, 0, 0) !default;

html, body {
    height: 100%;
    direction: ltr;
}

body {
    color: #000 !important;
    word-wrap: break-word;
    font-family: $o-default-report-font;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    margin-bottom: 0.5rem;
    font-weight: 500;
    line-height: 1.2;
}

h1, .h1 {
    font-size: 2.5rem;
}

h2, .h2 {
    font-size: 2rem;
}

h3, .h3 {
    font-size: 1.75rem;
}

h4, .h4 {
    font-size: 1.5rem;
}

h5, .h5 {
    font-size: 1.25rem;
}

h6, .h6 {
    font-size: 1rem;
}

p, span, strong, em {
    line-height: 1.5;
}

span.o_force_ltr {
    display: inline;
}
.o_force_ltr, .o_field_phone {
    unicode-bidi: embed; // ensure element has level of embedding for direction
    /*rtl:ignore*/
    direction: ltr;
}

.border-black td, .border-black th {
    border-top: 1px solid black !important;
}

/* See https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1524 */
.table-sm {
    > thead > tr > th {
        border-bottom: none !important;
    }
    > tbody > tr {
        page-break-inside: avoid !important;
        border-top: none !important;
    }
}
.zero_min_height {
    min-height: 0px !important;
}

/* To avoid broken snippets in report rendering */
.jumbotron, .panel, .carousel, section{
    page-break-inside: avoid;
}

/* Wkhtmltopdf doesn't support very well the media-print CSS (depends on the version) */
.d-print-none{
    display: none;
}

.o_bold {
    font-weight: bolder;
}
.o_italic {
    font-style: italic;
}
.o_underline {
    text-decoration: underline;
}

/*Total table*/
div#total {
    page-break-inside: avoid;
    table {
        tr {
            &.o_subtotal,
            &.o_total {
                td {
                    border-top: 1px solid black !important;
                }
                &.o_border_bottom {
                    td {
                        border-bottom: 1px solid black !important;
                    }
                }
            }
        }
    }
}

table {
    thead {
        &.o_black_border {
            tr {
                th {
                    border-bottom: 2px solid black !important;
                }
            }
        }
    }
}

// TODO: investigate further for proper fix
// By default there is 40px padding on the lists (both <ol> and <ul>) and it is
// also the case with HTML reports, but when PDFs are rendered with Wkhtmltopdf,
// the padding is not applied on <ol>, it is strangely applied on <ul> only.
// So we simply remove the left padding, and apply left margin instead which
// seems to do the job while not breaking layout in both html/pdf.
ol {
    margin-left: 40px;
    padding-left: 0;
}

/* Checklist */
ul.o_checklist {
    > li {
        list-style: none;
        position: relative;
        margin-left: 20px;

        &:not(.oe-nested):before {
            content: '';
            position: absolute;
            left: -20px;
            display: block;
            height: 14px;
            width: 14px;
            top: 1px;
            border: 1px solid;
            cursor: pointer;
        }
        &.o_checked:after {
            content: "✓";
            transition: opacity .5s;
            position: absolute;
            left: -18px;
            top: -1px;
            opacity: 1;
        }
    }
}

// Wkhtmltopdf doesn't handle flexbox properly, both the content
// of columns and columns themselves does not wrap over new lines
// when needed: the font of the pdf will reduce to make the content
// fit the page format.
// A (weak) solution is to force the content on one line and
// impose the width, so to have evenly size columns.
// This should work fine in most cases, but will yield ugly results
// when 6+ columns are rendered
.col-auto{
    -webkit-box-flex: 1 !important;
}

// Report footer need to support bootstrap columns (2, 3 and 4 columns)
// Even if the width is smaller than the media querry limit from bootstrap.
// This need come from the footer being editable via the Odoo editor.

.footer {
    .row {
        -webkit-box-flex: 1 !important;
    }
    .col-lg-3 {
        flex: 0 0 auto;
        -webkit-box-flex: 1 !important;
        width: 25%;
    }
    .col-lg-4 {
        flex: 0 0 auto;
        -webkit-box-flex: 1 !important;
        width: 33.33333333%;
    }
    .col-lg-6 {
        flex: 0 0 auto;
        -webkit-box-flex: 1 !important;
        width: 50%;
    }
}

// Boostrap 5 introduces variable paddings for container which wkhtmltopdf doesn't seem to process, so we restore Boostrap 4's paddings for PDFs
.container {
    padding-right: $container-padding-x;
    padding-left: $container-padding-x;
}

// Removes borders within a table-borderless as its new definition in Boostrap 5 still has its borders visible in PDFs 
.table-borderless {
    tbody, thead, tfoot, tr, td, th {
        border: 0 none;
    }
    > :not(:first-child) {
        border-top-style: none;
    }
}

li.oe-nested {
    display: block;
}
